// Copyright: personal possession of Nguyen Minh Kha
// Datetime: 09:26PM 10/14/2011
// Discription: This class is a common interface for 
//  all renderless object in game. This is base class for all object in game.
// Licencse: Free source
// Version: 1.0
// Writer: Nguyen Minh Kha

/* Google opensource coding standard with variable name exception */

#ifndef GAMEFRAMEWORK_MAP_H_
#define GAMEFRAMEWORK_MAP_H_

#include <Windows.h>
#include <d3dx9.h>

#include "log.h"
#include "define_class_id.h"

#include "objects_manager.h"
#include "renderable_manager.h"
#include "collisionable_manager.h"
#include "controllable_manager.h"
#include "eventable_manager.h"
#include "textures_manager.h"

#include "objects_header.h"


class Map
{
public:
  Map(void);
  ~Map(void);

  void Load(LPWSTR filePath);
  void Save(LPWSTR finePath);

  D3DXCOLOR getBackColor() {return this->backColor;}

private:
  // 
  // Default count line with "\r\n" spliter.
  //
  int CountLine(CString string);
  int CountLine(CString string, LPCWSTR spliter);
  void SplitString(CString* &str, CString input, LPWSTR spliter, int length);
  //
  // Get color from color format: r g b a
  //
  D3DXCOLOR ColorFromString(CString colorPart);
private:
  D3DXCOLOR backColor;
  CString nextMapName;
  CString nextMapPath;
  bool isLoaded;
};

#endif // GAMEFRAMEWORK_MAP_H_
